package com.neusoft.neu24g1.his.controller;

import com.neusoft.neu24g1.his.HisApplication;
import com.sun.javafx.geom.BaseBounds;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.control.ContentDisplay;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.text.TextBoundsType;
import org.kordamp.ikonli.javafx.FontIcon;

import java.io.IOException;

/**
 * RegisteredController 注册与挂号控制器
 *
 * @author Administrator
 * @version 2024/05/26 10:37
 **/
public class RegisteredController {

    private static final String IDLE_BUTTON_STYLE = "-fx-background-color: transparent;";
    private static final String HOVERED_BUTTON_STYLE = "-fx-background-color: -fx-shadow-highlight-color, -fx-outer-border, -fx-inner-border, -fx-body-color;";


    @FXML
    Pane  mainpane;

    @FXML
    VBox navbox;
    @FXML
    public void initialize() {

        FontIcon  icon =new FontIcon();
        icon.setIconLiteral("cib-about-me");
        icon.setIconSize(32);

        icon.setIconColor( Paint.valueOf("#456789") );



        navbox.getChildren().clear();

        Button button =new Button("挂号");
        button.setPrefWidth(288);
        button.setGraphic( icon );
        button.setTextFill( new Color(1,1,0.5,0.99));

        button.setStyle(IDLE_BUTTON_STYLE);
        button.setOnMouseEntered(e -> button.setStyle(HOVERED_BUTTON_STYLE));
        button.setOnMouseExited(e -> button.setStyle(IDLE_BUTTON_STYLE));
        button.setContentDisplay(ContentDisplay.TOP);


        button.setOnAction(event -> {
            FXMLLoader  loader =new FXMLLoader(HisApplication.class.getResource("controller/register-view.fxml"));
            try {
                AnchorPane anchorPane =  loader.load();
                mainpane.getChildren().clear();
                mainpane.getChildren().add( anchorPane );

            } catch (IOException e) {
                e.printStackTrace();
            }
        });




        navbox.getChildren().add(button);


        System.out.println("second");

    }



}